<template>
  <div>
    <el-form ref="form" :model="form" label-width="100px">
      <el-form-item label="管理员账号">
        <el-input v-model="form.managerAccount"></el-input>
      </el-form-item>
      <el-form-item label="管理员名字">
        <el-input v-model="form.managerName"></el-input>
      </el-form-item>
      <el-form-item label="管理员密码">
        <el-input v-model="form.managerPass" type="password"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="toSubmit">立即添加</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data () {
    return {
      form: {
        managerAccount: null,
        managerName: null,
        managerPass: null,
      },
      fileList: [],
      realFileUrl: [],
    };
  },
  methods: {
    // 创建新管理员
    async toSubmit () {
      let form = this.form;
      for (let each in form) {
        if (!form[each]) return this.$message.error("请填写完相关信息");
      }
      await this.$http.manager_register(form);
    },
  },
};
</script>

<style lang="less" scoped>
.el-form {
  margin-top: 20px;
}
</style>
